package com.guigu.qingcheng.controller;

import com.guigu.qingcheng.service.OrderFegin;
import com.qingcheng.entity.PageResult;
import com.qingcheng.util.JwtUtils;
import com.qingcheng.vo.goods.OrderListVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;


@RestController
@RequestMapping("/center")
public class CenterController {

    @Autowired
    private OrderFegin orderFegin;

    @PostMapping("/findOrderList")
    public PageResult<OrderListVo> findOrderList(int page, int size, @RequestParam(required = false,name = "orderStatus") String orderStatus, HttpServletRequest request){
        String username = null;
        try {
            username = JwtUtils.getMemberIdByJwtToken(request);
        } catch (Exception e) {
            e.printStackTrace();
            username="Patrick";
        }
        return orderFegin.findOrderList(page, size,orderStatus,username);
    }
}
